<template>
    <div v-if="isShow">
        <Select v-model="model" @on-change="handleSelectChange">
            <Option v-for="item in list" :value="item.ID + '' " :key="item.ID">{{ item.Dname }}</Option>
        </Select>
    </div>
</template>

<script>
import { getInfo } from './service';
export default {
    name: 'Dictionaries',
    props: ['value', 'id', 'currentModel', 'name'],
    data() {
        return {
            model: '',
            list: [],
            isShow: false
        };
    },
    methods: {
        handleSelectChange(e) {
            this.$emit('setDictionaries', e, this.value);
        }
    },
    mounted() {
        this.isShow = false;
        getInfo({
            parentname: this.name
        }).then(res => {
            this.list = res.data.rows;
            this.model = this.currentModel;
            this.isShow = true;
        });
    }
};
</script>

<style>
</style>
